<%@ page contentType="text/html; charset=gb2312" language="java"  errorPage="login.jsp"%>
<%@ page import="com.database.*"%>
<%
	String BranchID="";
    String OldBranchID = (String)session.getAttribute("oldBranchID");
    BranchID=OldBranchID;
  
  		if(session.getAttribute("branchid")!=null){
  			BranchID=(String)session.getAttribute("branchid");
  		}
	String sYGIDArray[] = request.getParameterValues("YGID");

	String roleList="";
	
	if (sYGIDArray !=null ){ 
		int len = java.lang.reflect.Array.getLength(sYGIDArray);
         for(int i=0;i<len;i++){
               		roleList = roleList + sYGIDArray[i] + ",";
                 //System.out.println("+++:"+sYGIDArray[i]);
               }
            System.out.println("--"+roleList);
		}
		else{
		response.sendRedirect("adminRole.jsp");
			   System.out.println("-222-"+roleList);
		}
String roleName=new String(request.getParameter("roleName").getBytes("iso8859_1"),"GBK");
DataBase db2=new DataBase();
String sql_insert="insert into cqms_role(BranchID,roleName,roleList,roleMenu)values('"+BranchID+"','"+roleName+"','','"+roleList+"')";
db2.executeUpdate(sql_insert);
db2.closeStmt();
db2.closeConn();
response.sendRedirect("adminRole.jsp");

%>